{% extends "base.html" %}

{% block title %}
    优就业OA-新闻管理
{% endblock %}

{% block style %}
    <style>
        .news_pic{
            width: 50px;
        }
    </style>
    <script src="/static/ckeditor/ckeditor.js"></script>
{% endblock %}


{% block label %}
    优就业OA-新闻管理
    <button class="btn btn-primary pull-right" data-toggle="modal" data-target="#news_panel">添加新闻</button>
{% endblock %}

{% block content %}

<!--文章展示列表-->
<table class="table">
    <thead>
        <tr>
            <th>文章id</th>
            <th>文章标题</th>
            <th>文章作者</th>
            <th>发表时间</th>
            <th>删除操作</th>
        </tr>
    </thead>
    <tbody>
        {% for news in news_list %}
        <tr>
            <td>{{ news.id }}</td>
            <td>
                <a href="/news_info/{{ news.id }}/">{{ news.title }}</a>
            </th>
            <td>{{ news.author }}</td>
            <td>{{ news.public_time }}</td>
            <td><a class="btn btn-danger" href="/del_news/{{ news.id }}/">删除新闻</a></td>
        </tr>
        {% endfor %}
    </tbody>
</table>

<ul class="pagination pull-right">
    <li><a href="#">1</a></li>
    <li><a href="#">2</a></li>
    <li><a href="#">3</a></li>
    <li><a href="#">4</a></li>
    <li><a href="#">5</a></li>
</ul>

<!--模态框编写-->
<div class="modal" id="news_panel">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">添加新闻</div>
            <form method="post" class="form form-horizontal" enctype="multipart/form-data">
                <div class="modal-body" style="overflow: hidden">
                    <div class="col-md-12">
                        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                        <div class="form-group">
                            <label class="control-label">新闻标题:</label>
                            <input class="form-control" type="text" name="title" placeholder="新闻标题">
                        </div>
                        <div class="form-group">
                            <label class="control-label">作者:</label>
                            <input class="form-control" type="text" name="author" placeholder="作者">
                        </div>
                        <div class="form-group">
                            <label class="control-label">新闻内容:</label>
                            <textarea class="ckeditor" name="content">
                            </textarea>
                        </div>
                        <div class="form-group">
                            <label class="control-label">文章图片:</label>
                            <input class="form-control" type="file" name="picture">
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <input class="btn btn-primary" type="submit" value="修改新闻">
                </div>
            </form>

        </div>
    </div>
</div>
{% endblock %}